package interview.Sorting;

public class InsertionSort {
	public static void sort(int[] num){
		int newValue,pos;
		for(int i=1;i<num.length;i++){
			newValue=i;
			pos=i-1;
			while(true){				
				if( (pos>=0) &&(num[newValue]<num[pos])){
					Generic.swap(num,newValue,pos);
					pos=pos-1;
					newValue=newValue-1;
				}
				else
					break;
			}
			Generic.printArray(num);
		}
	}
}
